.\"                                      Hey, EMACS: -*- nroff -*-
.\"
.\" Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
.\"
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH SCONVERT 1 "2014-10-28"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh        disable hyphenation
.\" .hy        enable hyphenation
.\" .ad l      left justify
.\" .ad b      justify to both left and right margins
.\" .nf        disable filling
.\" .fi        enable filling
.\" .br        insert line break
.\" .sp <n>    insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.UC 4
.SH NAME
sconvert \- convert spice formats
.SH SYNOPSIS
.B sconvert fromtype fromfile totype tofile
.br
.B sconvert fromtype totype
.br
.B sconvert
.br
.SH DESCRIPTION
.B Sconvert
translates spice output files among three formats: the old
binary format, a new binary format, and a new ascii format.
The formats are specified by the
.B fromtype
and
.B totype
arguments: `o' for the old format, `b' for the new binary format,
and `a' for the new ascii format.
.B Fromtype
specifies the format to be read, and
.B totype
specifies the format to be written.
If
.B fromfile
and
.B tofile
are given, then they are used as the input and output, otherwise
standard input and output are used.
(Note that this second option is only available on \s-2UNIX\s+2 systems
\- on VMS and other systems you must supply the filenames.)
If no arguments are given, the parameters are prompted for.
.PP
Binary format is the preferred format for general use, as it is
the most economical in terms of space and speed of access, and ascii is
provided to make it easy to modify data files and transfer them
between machines with different floating-point formats.
The old format is provided only
for backward compatibility.
The three formats are as follows:
.br
.nf

.B Old:

	    What		   Size in Bytes

	title				80
	date				8
	time				8
	numoutputs			2
	the integer 4			2
	variable names --
		char[numoutputs][8]	numoutputs * 8
	types of output			numoutputs * 2
	node index			numoutputs * 2
	plot title			numoutputs * 24
	the actual data			numpoints * numoutputs * 8

.B Ascii:

	Title: \fITitle Card String\fR
	Date: \fIDate\fR
	[ Plotname: \fIPlot Name\fR
	  Flags: \fIcomplex\fR or \fIreal\fR
	  No. Variables: \fInumoutputs\fR
	  No. Points: \fInumpoints\fR
	  Command: \fInutmeg command\fR
	  Variables:	0 \fIvarname1\fR \fItypename1\fR
			1 \fIvarname2\fR \fItypename2\fR
			etc...
	  Values:
	    0	n	n	n	n	...
	    1	n	n	n	n	...
	    And so forth...
	] repeated one or more times
.fi
.PP
If one of the flags is \fIcomplex\fR, the points look like r,i where r and i
are floating point (in %e format).
Otherwise they are in %e format.
Only one of \fIreal\fR and \fIcomplex\fR should appear.
.PP
The lines are guaranteed to be less than 80 columns wide (unless the
plot title or variable names are very long), so this format is safe
to mail between systems like CMS.
.PP
Any number of \fBCommand:\fR lines may appear between the \fBNo. Points:\fR
and the \fBVariables:\fR lines, and whenever the plot is loaded into
\fBnutmeg\fR they will be executed.
.nf

.B Binary:

	\fITitle Card\fR		  (a NULL terminated string)
	\fIDate, Time\fR		  (a NULL terminated string)
	[
	  \fIPlot title\fR 		  (a NULL terminated string)
	  \fINumber of variables\fR   (an int)
	  \fINumber of data points\fR (an int)
	  \fIflags\fR		  (a short)
	  \fIvariable header struct\fR (repeated numoutputs times)
		\fIvariable name\fR	  (a NULL terminated string)
		\fIvariable type\fR	  (an int)
	  \fIset of outputs\fR	  (repeated numpoints times)
	] repeated one or more times.
.fi
.PP
A set of outputs is a vector of doubles of length numoutputs, or
a vector of real-imaginary pairs of doubles if the data is complex.
.SH "SEE ALSO"
nutmeg(1), spice(1), writedata(3)
.SH AUTHOR
Wayne Christopher (faustus@cad.berkeley.edu)
.SH BUGS
If variable names and the title
and plotname strings have trailing
blanks in them they will be stripped off when the file is read, if
it is in ascii format.
.PP
If a plot title begins with "Title:" \fBnutmeg\fR will be fooled into thinking
that this is an ascii format file.
\fBSconvert\fR always requires the type to be specified, however.
